package cn.iocoder.yudao.module.forward.dal.mysql.broker;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.forward.dal.dataobject.broker.BrokerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.forward.controller.admin.broker.vo.*;

/**
 * 转发服务 Mapper
 *
 * @author zhang
 */
@Mapper
public interface BrokerMapper extends BaseMapperX<BrokerDO> {

    default PageResult<BrokerDO> selectPage(BrokerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BrokerDO>()
                .eqIfPresent(BrokerDO::getIp, reqVO.getIp())
                .likeIfPresent(BrokerDO::getClientName, reqVO.getClientName())
                .eqIfPresent(BrokerDO::getOutsideIp, reqVO.getOutsideIp())
                .eqIfPresent(BrokerDO::getEnable, reqVO.getEnable())
                .betweenIfPresent(BrokerDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BrokerDO::getId));
    }

}